package com.ft.oa.web.presalesController;

import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.industrys.IndustryContributor;
import com.ft.oa.service.industryService.IIndustryContributorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("/participatepeople")
public class IndustryParticipateController {
    @Autowired
    private IIndustryContributorService industryContributorService;
    /**
     *  获取行业参与人
     */
    @GetMapping("/participants")
    public ApiResult participants(@RequestParam int industryid , String industryName){
        HashMap<String,Object> participantsMap = new HashMap<>();
        participantsMap.put("participantsDatas",industryContributorService.participants(industryid,industryName));
        return ApiResult.builder().code(200).msg("行业参与人返回成功").data(participantsMap).build();
    }
    /**
     * 删除行业参与人
     */
    @GetMapping("/dellparticipants")
    public ApiResult dellparticipants(@RequestParam int peopleid){
        return ApiResult.builder().code(200).msg("行业参与人删除成功").data(industryContributorService.dellparticipants(peopleid)).build();
    }
    /**
     * 新增参与人
     */
    @PostMapping("/addpeople")
    public ApiResult addpeople(@RequestBody IndustryContributor industryContributor){
      return ApiResult.builder().code(200).msg("新增行业参与人").data(industryContributorService.addpeople(industryContributor)).build();
    }
}
